<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<input type="file" id="myfile" multiple/>
<script type="text/javascript">

    /**
     *    navigator.webkitTemporaryStorage
     *    navigator.webkitPersistentStorage
     */


    /**
    navigator.webkitPersistentStorage.requestQuota(1024*1024, function(grantedBytes) {
        debugger;
        window.webkitRequestFileSystem(PERSISTENT, grantedBytes, function(fs){
            debugger;
            fs.root.getFile('log.txt', {create: false}, function(fileEntry) {
                debugger;

                fileEntry.createWriter(function(fileWriter) {
                    fileWriter.onwriteend = function(e) {
                        console.log('Write completed.');
                    };
                    fileWriter.onerror = function(e) {
                        console.log('Write failed: ' + e.toString());
                    };
                    // Create a new Blob and write it to log.txt.
                    var blob = new Blob(['Lorem Ipsum'], {type: 'text/plain'});
                    fileWriter.write(blob);
                }, errorHandler);





                        // fileEntry.isFile === true
                // fileEntry.name == 'log.txt'
                // fileEntry.fullPath == '/log.txt'
            }, errorHandler);

            fs.root.getDirectory('/', {}, function(dirEntry){
                debugger;
                var dirReader = dirEntry.createReader();
                dirReader.readEntries(function(entries) {
                    for(var i = 0; i < entries.length; i++) {
                        var entry = entries[i];
                        if (entry.isDirectory){
                            console.log('Directory: ' + entry.fullPath);
                        }
                        else if (entry.isFile){
                            console.log('File: ' + entry.fullPath);
                        }
                    }
                });
            });

        }, errorHandler);
    }, errorHandler);
    **/
    var errorHandler = function(err){
        alert('err:' + err);
    };
    var requestFileSystem = window.webkitRequestFileSystem || window.requestFileSystem;
    //window.TEMPORARY
    //window.PERSISTENT
    requestFileSystem(window.TEMPORARY, 0, function(fs){
        fs.root.getDirectory('/', {}, function(dirEntry){
            debugger;
            var str = "listFiles:\n";
            var dirReader = dirEntry.createReader();
            dirReader.readEntries(function(entries) {
                str += "entries.length:" + entries.length + "\n";
                for(var i = 0; i < entries.length; i++) {
                    var entry = entries[i];
                    if (entry.isDirectory){
                        str += ('Directory: ' + entry.fullPath) + "\n";

                    }
                    else if (entry.isFile){
                        str +=('File: ' + entry.fullPath) + "\n";
                    }
                }
                console.log(str);
                alert(str);
            });
        });
    });

</script>


</body>
</html>